<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
import '@/styles/reset.less'
import '@/styles/common.less'
import '@/styles/index.css'
export default {
  name: 'App',
  created () {
    this.setTitle()
  },
  watch: {
    $route (newVal) {
      this.setTitle(newVal.meta.title)
    }
  },
  methods: {
    setTitle (_title) {
      let title
      if (_title) {
        title = _title
      } else {
        title = this.$route.meta.title
      }
      if (title) {
        document.title = title + ' - ' + this.$config.SYS_NAME
      } else {
        document.title = this.$config.SYS_NAME
      }
    }
  }
}
</script>

<style lang="less">
</style>
